#ifndef _main__h
#define __main_h
//HAL--------------------



//Const--------------------
//base 4ms
#define D_1s         250   //1s
#define D_40ms       10    //40ms
#define D_300ms   75 //300ms
#define D_500ms      125     //500ms
#define D_1m        60
#define D_5s       5   //5s

#define D_YuYue 1
#define  D_up  2
#define  D_down  3
#define D_OnOff 4
#define D_TiaoWen 5
#define D_DangWei 6

//Var----------------------
#ifdef  MAIN_C
uint8_t data  timer40ms;
uint8_t data timer1m;
uint8_t data timer1s;
uint8_t data  timer500ms;
uint8_t data longKeyHoldTime;
uint8_t data longKeyValue;
uint8_t data holdKey;
uint8_t data longKeyJudgeTime;
uint8_t data keyValue;
uint8_t data startTime;
uint8_t data setCurTemp;
bit data bError;
bit data bError1;
bit data bError2;
bit data bAdShort;
bit data bAdOffBuzz;
uint8_t data adShortNum;
bit data bAdShortBuzz;
uint8_t data adOffBuzzNum;
uint8_t data adShortBuzzNum;
bit data bHigTemp;
bit data bOrderOpen;
bit data bOrderClose;
bit  data bSecFlash500ms;
uint8_t data timer300ms;
bit data bError3;
bit data bUpdateCurTemp;
bit data bShengDian;
bit data bZengRong;
bit data bFlashShengDian;
bit data bFlashZengRong;
uint8_t data mainClockHour;
uint8_t data mainClockMin;
uint8_t data orderClockOpenHour;
uint8_t data orderClockOpenMin;
uint8_t data yuYueNum;
uint8_t data orderClockCloseHour;
uint8_t data orderClockCloseMin;
uint8_t data flashFalg;
bit data bPowerOnOff;
uint8_t data flashYuYue;
bit data bSaveTemp;
bit data bHuaSa;
bit data bQuan;
uint8_t data flashSetMode;
uint8_t data huaSaNum;
uint8_t data quanNum;
uint8_t data remKeyAdd;
uint8_t data flashSetCurTemp;
bit data delaySetPowerH;
bit  data lastBSaveTemp;
uint8_t data mainClockMiao;
bit bNoClock;
uint8_t a;
bit bWIFIRest;
uint8_t WIFIRestNum;
bit bUpdateTime;
uint8_t dangWeiNum;
bit  bQuanBuGuan;
bit bDingShiKai;
bit bDingShiGuan;
uint8_t timer5s;
bit bSecFlash5s;
#else
	extern bit bSecFlash5s;
	extern uint8_t timer5s;
extern	bit bDingShiKai;
 extern bit bDingShiGuan;
extern bit  bQuanBuGuan;
extern uint8_t dangWeiNum;
extern bit bUpdateTime;
extern bit bWIFIRest;
extern uint8_t WIFIRestNum;
extern uint8_t a;
extern bit bNoClock;
extern uint8_t data mainClockMiao;
extern bit data lastBSaveTemp;
extern bit data delaySetPowerH;
extern uint8_t data flashSetCurTemp;
extern uint8_t data remKeyAdd;
extern uint8_t data quanNum;
extern uint8_t data huaSaNum;
extern bit data bHuaSa;
extern bit data bQuan;
extern uint8_t data flashSetMode;
extern bit data  bSaveTemp;
extern uint8_t data flashYuYue;
extern bit data bPowerOnOff;
extern uint8_t data flashFalg;
extern uint8_t data yuYueNum;
extern uint8_t data orderClockCloseHour;
extern uint8_t data orderClockCloseMin;

extern uint8_t data orderClockOpenHour;
extern uint8_t data orderClockOpenMin;
extern	uint8_t data mainClockHour;
extern uint8_t data mainClockMin;
extern bit data bShengDian;
extern bit data bZengRong;
extern bit data bFlashShengDian;
extern bit data bFlashZengRong;
extern uint8_t  data timer40ms;
extern uint8_t data timer1m;
extern uint8_t data timer1s;
extern uint8_t  data timer500ms;
extern uint8_t data longKeyHoldTime;
extern uint8_t data longKeyValue;
extern uint8_t data holdKey;
extern uint8_t data longKeyJudgeTime;
extern uint8_t data keyValue;
extern uint8_t data startTime;
extern uint8_t data setCurTemp;
extern bit data bError;
extern bit data bError1;
extern bit data bError2;
extern bit data bAdShort;
extern bit data bAdOffBuzz;
extern uint8_t data adShortNum;
extern bit data bAdShortBuzz;
extern uint8_t data adOffBuzzNum;
extern uint8_t data adShortBuzzNum;
extern bit data bHigTemp;
extern bit data bOrderOpen;
extern bit data bOrderClose;
extern bit  data bSecFlash500ms;
extern uint8_t data timer300ms;
extern bit data bError3;
extern bit data bUpdateCurTemp;
#endif


//Function----------------------
	void zuiJinDingShi();
void  KeyTiaoWen2();
void ShiZhongChuLi1(uint8_t openHour,uint8_t openMin,uint8_t closeHour,uint8_t closeMin);
void ShiZhongChuLi2(uint8_t openHour,uint8_t openMin,uint8_t closeHour,uint8_t closeMin);
void LongKeyYuYue();
void	remKey();
void OrderOpen();
void PowerSet();
void timerControl();
void getKey();
void keyUp();
void keyDown();
void PowerOff();
void keyOnOff();
void keyYuYue();
void KeyTiaoWen();
void KeyDangWei();
void Error();
void SetFlashYuYue();

#endif